# 需要安装的库
# pip install requests

"""
正向代理服务器，可以通过squid自己搭建，过程比较简单
"""

import requests
if __name__ == '__main__':

    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36'
    }
    url = "https://www.baidu.com"


    proxyHost = "192.168.0.1"
    proxyPort = "8080"
    proxyUser = "H96A209NR"
    proxyPass = "1BF310277"

    proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % {
        "host": proxyHost,
        "port": proxyPort,
        "user": proxyUser,
        "pass": proxyPass,
    }
    proxies = {
        "http": proxyMeta,
        "https": proxyMeta,
    }
    res = requests.get(url=url, headers=headers, proxies=proxies, timeout=60)


    print(res.status_code)
    print(res.text)